// 导入路由
import { Router, Route, Switch, Redirect } from "react-router-dom"
// 路由鉴权
import { AuthRoute } from "@/components/AuthRoute"
// 导入页面组件
import Login from "@/pages/Login"
import Layout from "@/pages/Layout"
import NotFound from "@/pages/NotFound/index"
// 导入自定义的 history 对象
import { customHistory } from "@/utils"
function App() {
  return (
    <div className="App">
      <Router history={customHistory}>
        <Switch>
          {/* exact 精确匹配 */}
          <Route exact path="/" render={() => <Redirect to="/home" />} />
          <AuthRoute path="/home" component={Layout}></AuthRoute>
          <Route path="/login" component={Login}></Route>
          <AuthRoute component={NotFound}></AuthRoute>
        </Switch>
      </Router>
    </div>
  )
}

export default App
